#!/usr/bin/env python3

"""
SVTest: A toolkit for testing SV pipeline output files and generating metrics.

usage: svtest [-h] <subcommand> [options]

subcommands:
    baf-file      BAF file
    bincov-matrix Bincov matrix
    gt-cutoffs    Genotyping cutoffs file
    medcov        Median coverage file
    merged-depth  Merged depth bed file
    metrics-file  Evidence metrics file
    pe-file       Discordant read pair file
    ped-file      Family file
    plot-metrics  Generates comparison plot and table of two metrics files
    raw-counts    Count file
    rf-cutoffs    Random forest cutoffs file
    sample-list   Sample id list
    sr-file       Split read file
    vcf           VCF

"""

import argparse
import sys
import svtest.cli as cli


def main():
    parser = argparse.ArgumentParser(
        description=__doc__,
        usage=argparse.SUPPRESS,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('subcommand', help=argparse.SUPPRESS)

    if len(sys.argv) < 2:
        parser.print_help()
        sys.exit(1)

    args = parser.parse_args(sys.argv[1:2])
    command = args.subcommand.replace('-', '_')

    if not hasattr(cli, command):
        print('Unrecognized command: {0}'.format(args.subcommand))
        parser.print_help()
        sys.exit(1)

    getattr(cli, command)(sys.argv[2:])

if __name__ == '__main__':
    main()
